package com.forage.exp.controller;

import com.forage.exp.constant.ResponseStatusEnum;
import com.forage.exp.po.Response;
import com.forage.exp.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.iceclean.logtrace.annotation.EnableLogTrace;
import top.iceclean.logtrace.bean.Logger;

/**
 * @author : Ice'Clean
 * @date : 2022-05-12
 */
@RestController
@RequestMapping("content")
@EnableLogTrace
public class ContentController {

    @Autowired
    private ContentService contentService;

    Logger logTrace;

    @GetMapping("/{kindId}/{page}/{num}")
    public Object getContentByKind(@PathVariable int kindId,
                                   @PathVariable int page,
                                   @PathVariable int num) {
        return new Response()
                .setStatus(ResponseStatusEnum.OK)
                .addData("contentList", contentService.getContentByKind(kindId, page, num));
    }
}
